Skip to content

Add EnvVarHeaderContentGuard - #8015

Open
decko wants to merge 1 commit into
pulp:mainfrom
decko:pulp-2257-envvar-header-guard
Open

Add EnvVarHeaderContentGuard#8015
decko wants to merge 1 commit into
pulp:mainfrom
decko:pulp-2257-envvar-header-guard

Conversation

@decko

@decko decko commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds EnvVarHeaderContentGuard so a Base64-encoded request header can be checked against a content-app environment variable (fixes #8007). Rotation is a deploy/env change, not a DB update of HeaderContentGuard.header_value.
  • env_var must be listed in ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS (default []). The secret is never stored or returned by the API.
  • Unit and functional tests use ENVVAR_HEADER_GUARD_TEST_SECRET from the Pulp container env (injected via template_config.yml / CI pulp_env).

Test plan

  • pytest -k envvar_header unit tests (secret + allowlist set in the pulp container)
  • pytest -k envvar_header functional tests (create guard, 403 without/wrong header, 404 with matching Base64 header, 400 for disallowed env_var, access policy present)
  • Confirm OpenAPI path /pulp/api/v3/contentguards/core/envvar_header/ and that GET does not expose a secret value

Related: PULP-2257, pulp-service prototype pulp/pulp-service#1420

Closes #8007

Assisted-by: Cursor Grok 4.6

Made with Cursor

Validate a Base64-encoded request header against a content-app
environment variable so shared secrets can rotate without updating
guard records. Names must be listed in
ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS.

fixes pulp#8007

Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add EnvVarHeaderContentGuard for env-backed header secret validation

1 participant